package nl.haemers.data.reflection 
{
	import flash.utils.getDefinitionByName;
	import nl.haemers.data.constants.DataTypes;
	
	import nl.haemers.data.utils.ObjectUtils;
	import nl.haemers.data.serializers.ObjectSerializer;
	import nl.haemers.data.constants.ReflectionConstants;
	/**
	 * ...
	 * @author Jonathan Haemers
	 */
	public class Accessor extends Property implements IAccessor 
	{
		private var _access				:String;
		private var _declaredBy			:String;
		
		public function Accessor(description:XML) 
		{
			super(description);
			init(description);
		}
		
		/** Public methods **/
		
		/** Getters & Setters **/
		/**
		 * @inheritDoc
		 */
		public function get acces():String 
		{
			return _access;
		}
		/**
		 * @inheritDoc
		 */
		override public function get overwriteable() : Boolean
		{
			return writeable ? _overwriteable : false;
		}
		/**
		 * @inheritDoc
		 */
		override public function get writeable() : Boolean
		{
			return acces == ReflectionConstants.READWRITE || acces == ReflectionConstants.WRITEONLY;
		}
		
		/**
		 * @inheritDoc
		 */
		public function get declaredBy() : String
		{
			return _declaredBy;
		}
		/** Protected methods **/
		
		/** Private methods **/
		private function init(xml:XML) : void
		{
			this._access = xml.@access;
			this._declaredBy = xml.@declaredBy
		}
		/*
			<accessor name="url" access="readwrite" type="String" declaredBy="nl.haemers.test.data.vo::PageVO">
			  <metadata name="Serialize">
				<arg key="name" value="page"/>
			  </metadata>
			  <metadata name="__go_to_definition_help">
				<arg key="file" value="D:\work\asjlib\trunk\src\nl\haemers\test\data\vo\PageVO.as"/>
				<arg key="pos" value="546"/>
			  </metadata>
			  <metadata name="__go_to_definition_help">
				<arg key="file" value="D:\work\asjlib\trunk\src\nl\haemers\test\data\vo\PageVO.as"/>
				<arg key="pos" value="611"/>
			  </metadata>
			</accessor>
		*/
	}

}